import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { GenealogyModelVO, GenealogyModelForm, GenealogyModelQuery } from '@/api/genealogy/genealogyModel/types';

/**
 * 查询世系图模板列表
 * @param query
 * @returns {*}
 */

export const listGenealogyModel = (query?: GenealogyModelQuery): AxiosPromise<GenealogyModelVO[]> => {
  return request({
    url: '/genealogy/genealogyModel/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询世系图模板详细
 * @param id
 */
export const getGenealogyModel = (id: string | number): AxiosPromise<GenealogyModelVO> => {
  return request({
    url: '/genealogy/genealogyModel/' + id,
    method: 'get'
  });
};

/**
 * 新增世系图模板
 * @param data
 */
export const addGenealogyModel = (data: GenealogyModelForm) => {
  return request({
    url: '/genealogy/genealogyModel',
    method: 'post',
    data: data
  });
};

/**
 * 修改世系图模板
 * @param data
 */
export const updateGenealogyModel = (data: GenealogyModelForm) => {
  return request({
    url: '/genealogy/genealogyModel',
    method: 'put',
    data: data
  });
};

/**
 * 删除世系图模板
 * @param id
 */
export const delGenealogyModel = (id: string | number | Array<string | number>) => {
  return request({
    url: '/genealogy/genealogyModel/' + id,
    method: 'delete'
  });
};
